package com.rainy.sso.server.config;

import com.rainy.sso.server.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author liuqin on 2017/12/23
 */
@Configuration
public class SsoWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter{
    @Bean
    public LoginInterceptor getRequestInterceptor(){
        return new LoginInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getRequestInterceptor()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
